<?
	include("common.php");

	if(!$loggedin){
		ob_start();
		header("Location: login.php");
	}
	include("header.php");

/*
CREATE TABLE forum (
	id smallint(6) NOT NULL auto_increment,
	name varchar(80) default NULL,
	description text,
	uid int(11) NOT NULL default '0',
	PRIMARY KEY  (id)
) TYPE=MyISAM;
*/

	if($_POST['act']){
		if($_POST['act'] == "a"){
			$strQuery  = "INSERT INTO forum SET ";
			$strQuery .= "name='{$fname}',";
			$strQuery .= "description='$fdescription',";
			$strQuery .= "uid='{$fuid}'";
		}else{
			$strQuery  = "UPDATE forum SET ";
			$strQuery .= "name='{$fname}',";
			$strQuery .= "description='$fdescription',";
			$strQuery .= "uid='{$fuid}' WHERE id='$fid'";
		}
		if(mysql_query($strQuery)){
?>
			<span class="title">Update Complete</span><br><br>
			You have sucsessfully updated your Forum.
			<a href="account.php">Continue</a>
<?php
		}
	}
?>
<table cellpadding=0 cellspacing=0 width=90% style="border:1px solid #000000;">
<tr>
	<TD width=80% style="padding-left:10px;padding-right:10px;"><br>
		<b>My Forum</b><br><br>
<?
	$qr1 = mysql_query("SELECT * FROM forum WHERE uid='$myuid'");
	if( mysql_num_rows($qr1) > 0){
		$forum = mysql_fetch_object($qr1);
		$act = "e";
	}else{
		$act = "a";
	}
?>
		<form method="POST">
		<input type="hidden" name="act" value="<?=$act?>">
		<input type="hidden" name="fuid" value="<?=$myuid?>">
<?		if($forum->id){	?>
		<input type="hidden" name="fid" value="<?=$forum->id?>">
<?		}	?>
		<table cellpadding=0 cellspacing=0 width=100% style="border:1px solid #000000;">
		<TR>
			<td style="padding-left:10px;border-bottom:1px solid #000000;border-right:1px solid #000000" class=small width=40%><FONT face=arial size=3><B>
				Name:
			</B></FONT></TD>
			<td style="padding-left:10px;border-bottom:1px solid #000000;" class=small ><FONT face=arial size=3>
				<input type="text" name="fname" value="<?=$forum->name?>">
			</FONT></TD>
		</TR>
		<TR>
			<td style="padding-left:10px;border-bottom:1px solid #000000;border-right:1px solid #000000" class=small width=40%><FONT face=arial size=3><B>
				description:
			</B></FONT></TD>
			<td style="padding-left:10px;border-bottom:1px solid #000000;" class=small ><FONT face=arial size=3>
				<input type="text" name="fdescription" value="<?=$forum->description?>">
			</FONT></TD>
		</TR>
		<TR>
			<td colspan=2 align=center style="padding-left:10px;border-bottom:1px solid #000000;border-right:1px solid #000000" class=small width=40%>
				<INPUT style="width:150px;BORDER-RIGHT: #000000 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #a0a0a0 1px solid; PADDING-LEFT: 2px; FONT-WEIGHT: bold; FONT-SIZE: 11px; PADDING-BOTTOM: 2px; BORDER-LEFT: #a0a0a0 1px solid; color:#000000; PADDING-TOP: 2px; BORDER-BOTTOM: #000000 1px solid; FONT-FAMILY: Verdana,Arial; BACKGROUND-COLOR: #e5e5e5; outline: #a0a0a0 solid 2px" type=submit value="Save Forum">
			</td>
		</tr>
		</TABLE><BR>
		<br>
	</td>
</tr>
</table>
<Br>
<BR><FONT face=arial size=3>
<?
	include("footer.php");
?>
